package besta.moon.engine.selector;

public final class DataSources {

    private int size;
    private DataSource[] data = new DataSource[4];

    public final int size() {
        return size;
    }

    public final DataSource get(int idx) {
        if (idx >= size) {
            throw new IndexOutOfBoundsException("Index: " + idx + ", Size: " + size);
        }
        return data[idx];
    }

    public final void add(DataSource table) {
        if (size >= data.length) {
            DataSource[] dataNew = new DataSource[size << 1];
            System.arraycopy(data, 0, dataNew, 0, size);
            data = dataNew;
        }
        data[size++] = table;
    }
}
